<template>
    <form action="" style="width: 100%;height: 100%;" v-loading="loading" element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
        <div style="width: 100%;height: 100%;">
            <div style="width: 100%;height: 9%;display: flex;align-items: center;">
                <div class="scrollable-div" ref="scrollableDiv" @wheel="scrollHorizontally">
                    <el-radio v-for="(item,index) in allForm" :key="index" v-model="radio1" :label="item.label" border>{{
                        returnTitle(index) }}</el-radio>
                </div>

                <div style="margin-left: auto;display: flex;gap:15px;">
                    <div style="display: flex; align-items: center; justify-content: center; width: 28px; "
                        class="btn_width">
                        <el-button style="width: 28px;height: 28px;" icon="el-icon-refresh-right" @click="reNewDataAction()"></el-button>
                    </div>
                    <div class="btn_second">
                        <el-popover placement="top-start" title="标题" width="200" trigger="hover" content="新增一条管网至主控阀">
                            <el-button slot="reference" @click="add" icon="el-icon-plus">新增</el-button>
                        </el-popover>
                    </div>
                    <div class="btn_three">
                        <el-popover placement="top-start" title="标题" width="200" trigger="hover" content="删除所有选中的管网至主控阀">
                            <el-button slot="reference" @click="remove" icon="el-icon-delete">删除</el-button>
                        </el-popover>
                    </div>

                </div>
            </div>
            <div
                style="height: 84.5%;position: relative; overflow: auto;padding: 10px;border: 1px solid rgb(221, 228, 239);">
                <div style="display: flex;  align-items: center; width: 100%;">
                    <div class="before"></div>
                    <div >有限空间(厨房、生产车间、锅炉)</div>
                    <div class="smallTilte">
                <div>①了解潮流走向，进气和出气。</div>
                <div>②了解并拍摄全景照片</div>
                </div>
                    <div style="display: flex;margin-left: auto;align-items: center;gap: 15px;width: 40%;">
                        <div >备注</div>
                        <el-input v-model="allForm[radio1].data.notes.content" placeholder="请输入" style="width: 90%;"></el-input>
                  

                    </div>
                </div>


                <div class="titleStyle">
                    <div class="inputHorizon" v-for="item in allForm[radio1].data.kownleageAndPhotoFullScenceImage"
                        :key="item.id">
                        <div style="width: 112px;text-align: right;margin-right: 20px;">{{ item.name }}</div>
                        <div style="width: 56%;" v-if="item.componentType == false">
                            <el-select v-model="item.content" :placeholder="item.placeholder" style="width: 100%;" clearable>
                                <el-option v-for="items in item.data" :key="items.id" :label="items.name" :value="items.id">
                                </el-option>
                            </el-select>
                        </div>

                        <el-input v-if="item.componentType == true" v-model="item.content" :placeholder="item.placeholder" clearable
                            style="width: 56%;" @input="restrictNumericInput(item)"></el-input>
                    </div>
                </div>
           

                <div class="contentPadding" style="width: 100%; display: flex; flex-wrap: wrap;gap: 1%;">
                <div style="border-radius: 4px;border: 1px solid #DCDFE6;margin-top: 20px;width: 19.2%;height: 202px;" v-for="(item, index) in allForm[radio1].data.fullScenceImage" :key="index">
                    <div style="display: flex; padding: 10px;padding-left: 30px;align-items: center;">
                                <div style="width: 4px;height: 15px;background-color: rgb(24, 144, 255);margin-right: 5px;border-radius: 2px;">
                                </div>
                                <div>{{ item.title }}</div>
                            </div>
                            <div style="width: 100%;height: 0.5px;background-color: rgb(220, 223, 230);"></div>
                            <div style="width: 100%;justify-content: center;padding: 20px;padding-left: 33px; ">
                          
                            <div
                                style="display: flex;gap:25px;text-align: center;">
                          
                                <div style="width: 120px;height: 120px;position: relative;" class="demo-image__error">
                                    <el-image v-show="fullScenceImage[index].imageAddress.length>0" style="width: 100%;height: 100%;"
                                            :src="fullScenceImage[index].imageAddress[0]"
                                            :preview-src-list="fullScenceImage[index].imageAddress">
                                            <div slot="error" class="image-slot">
                                                <img src="../../assets/images/stageIcon/加载失败.jpeg" alt=""
                                                    style="width: 100%;height: 100%;">
                                            </div>
                                        </el-image>
                                        <img v-show="fullScenceImage[index].imageAddress.length==0" src="../../assets/images/stageIcon/暂无图片.png" alt="" style="width: 100%;height: 100%;">
                                        <div class="imageSample" v-show="fullScenceImage[index].imageAddress.length>0">范例图</div>
                                </div>
                                <div style="width: 120px;height: 120px;">
                                    <imageLookSeventh :upAddress="item.upAddress" :imageData="item.imageData"
                                            :projectInfo="projectInfo" :id="stageSurveyConfinedSpaceList[radio1].id"
                                            :dictName="item.dictName" :sampleImageAll="fullScenceImage" :imageIndex="index" :flieName="item.title"></imageLookSeventh>

                                </div>
                            </div>
                        </div>
                </div>
        </div>

                <div style="display: flex;  align-items: center;margin-top: 30px;">
                    <div class="before"></div>
                    <div>燃气设施情况</div>
                    <div style="display: flex;font-size: 14px;color: rgb(144, 147, 163);">

                    </div>
                </div>
                <div class="titleStyle">
                    <div class="inputHorizon" v-for="item in allForm[radio1].data.energyDeviceSituation" :key="item.id">
                        <div style="width: 112px;text-align: right;margin-right: 20px;">{{ item.name }}</div>
                        <div style="width: 56%;" v-if="item.componentType == false">
                            <el-select v-model="item.content" placeholder="请选择" style="width: 100%;" clearable>
                                <el-option v-for="items in item.data" :key="items.id" :label="items.name" :value="items.id">
                                </el-option>
                            </el-select>
                        </div>

                        <el-input v-if="item.componentType == true" v-model="item.content" :placeholder="item.placeholder" clearable
                            style="width: 56%;" @input="restrictNumericInput(item)"></el-input>
                    </div>
                </div>
                <div style="display: flex;  align-items: center;margin-top: 30px;">
                    <div class="before"></div>
                    <div>配置情况</div>
                    <div style="display: flex;font-size: 14px;color: rgb(144, 147, 163);">

                    </div>
                </div>
                <div class="titleStyle">
                    <div class="inputHorizon" v-for="item in allForm[radio1].data.distributeSituation" :key="item.id">
                        <div style="width: 112px;text-align: right;margin-right: 20px;">{{ item.name }}</div>
                        <div style="width: 56%;" v-if="item.componentType == false">
                            <el-select v-model="item.content" :placeholder="item.placeholder" style="width: 100%;" clearable>
                                <el-option v-for="items in item.data" :key="items.id" :label="items.name" :value="items.id">
                                </el-option>
                            </el-select>
                        </div>

                        <el-input v-if="item.componentType == true" v-model="item.content" :placeholder="item.placeholder"
                            style="width: 56%;" clearable
                            @input="restrictNumericInput(item)"></el-input>
                    </div>
                </div>

                <div style="display: flex;flex-wrap: wrap;">
                    <div v-for="(item,index) in allForm[radio1].data.situationImage" :key="item.id" class="horizonDIsplay">
                        <div >{{ item.title }}</div>
                        <div style="position: relative;width: 27%;margin-left: 30px;margin-right: 30px;" >
                            <div class="demo-image__preview">
                                <el-image v-show="situationImage[index].imageAddress.length>0" style="width: 100%; height: 150px;"
                                    :src="situationImage[index].imageAddress[0]" :preview-src-list="situationImage[index].imageAddress">
                                </el-image>
                                <img v-show="situationImage[index].imageAddress.length==0" src="../../assets/images/stageIcon/暂无图片.png" alt="" style="width: 100%;height: 150px;">
                            </div>
                            <div class="overlay" v-show="situationImage[index].imageAddress.length>0">范例图</div>
                        </div>
                        <div style="width:27%;">
                        <image-dialog :upAddress="item.upAddress" :imageData="item.imageData"
                            :projectInfo="projectInfo"></image-dialog>
                        <imageLookEight :upAddress="item.upAddress" :imageData="item.imageData" :projectInfo="projectInfo"
                            :id="stageSurveyConfinedSpaceList[radio1].id" :dictName="item.dictName" :sampleImageAll="situationImage" :imageIndex="index" :flieName="item.title"></imageLookEight>
                        </div>
                    </div>
                </div>
            </div>
            <el-button class="buttonStyle" @click="submit">保存</el-button>
        </div>
    </form>
</template>
<script>

import { updateSurveyApi } from "@/api/project/survey";
import { getTemplateFileListApi } from "@/api/project/file";
import { limitSpace, addLimitSpace, removeLimitSpace } from "@/api/project/stageApi";
import imageLookSeventh from "../OtherOwerUseComponent/imageLookSeventh.vue";
import { getInfo } from "@/api/project/info";
import imageLookEight from "../OtherOwerUseComponent/imageLookEight.vue";
export default {
    created() {
        // this.add()
        const projectId = this.$route.params && this.$route.params.projectId;
        this.getInfo(projectId);
    },
    props: ['jsonData', 'imageData', 'projectInfo'],
    watch: {
        projectInfo: {
            handler(newData, oldData) {
                ///获取基本信息
                this.getData()
            },

        },
        jsonData: {
            handler(newData, oldData) {
               
            },
            immediate: true // 立即触发一次，以便在初始值传递时也能运行方法
        },
    
    },
    components: {
        imageLookSeventh,
        imageLookEight
    },
    data() {
        return {
            loading: false,
            situationImage: [
                { id: 1, title: "有限空间全景图", imageAddress: [], dictName: 'panorama', content: '', upAddress: '勘察范例/有限空间场景/配置情况/有限空间全景图', imageData: {} },
                { id: 2, title: "管道设备连接图", imageAddress: [], dictName: 'pipelineEquipmentConnectionDiagram', content: '', upAddress: '勘察范例/有限空间场景/配置情况/管道设备连接图', imageData: {} },
            ],
            fullScenceImage: [
                { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/现场照片', imageData: {}, description: '阀门损坏描述' },
                { id: 1, title: "阀门损坏", imageAddress: [], dictName: 'valveDamage', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/阀门损坏', imageData: {}, description: '阀门损坏描述' },
                { id: 2, title: "管道占压", imageAddress: [], dictName: 'pipelinePressure', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/管道占压', imageData: {}, description: '管道占压描述' },
                { id: 3, title: "管道法兰生锈", imageAddress: [], dictName: 'rustOnPipelineFlanges', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/管道法兰生锈', imageData: {}, description: '管道法兰生锈描述' },
            ],
            input: '',
            checked: '',

            ///有限空间数据
            stageSurveyConfinedSpaceList: [],
            radio1: 0,
            allForm: [],



            
            imageFlieLocation: "勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/",
        }
    },
    name: "limitedSpaceScence",
    mounted() {
        // this.getImage('勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)', this.fullScenceImage)
        // this.getImage('勘察范例/有限空间场景/配置情况', this.situationImage)
    },
    methods: {
        returnTitle(index){
            
            if (this.allForm[index].data.notes.content!=null){
                return this. allForm[index].data.notes.content
            }
            return '有限空间场景'+(index+1) 
        },
        getData(){
            this.loading=true
            limitSpace(this.projectInfo.projectId).then(response => {
                this.loading=false
                    if (response.code == 200) {
                        this.stageSurveyConfinedSpaceList = response.data
                    
                        this.distrbute()

                    }
                })
        },
        reNewDataAction(){
            this.getImage('勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)', 1)
            this.getImage('勘察范例/有限空间场景/配置情况', 2)
            this.getData()
        },
        getInfo(projectId) {
            getInfo(projectId).then(response => {
                this.projectInfo = response.data;

            })
        },
        reNew() {
            ///获取基本信息
            limitSpace(this.projectInfo.projectId).then(response => {
                if (response.code == 200) {
                    this.stageSurveyConfinedSpaceList = response.data
                    this.distrbute()

                }
            })
        },
        ///删除表单行动
        remove() {

            if (this.allForm.length > 1) {
                ///删除操作


                let id = this.stageSurveyConfinedSpaceList[this.radio1].id

                removeLimitSpace(id).then(response => {
                    if (response.code == 200) {
                        if (this.radio1 == this.allForm.length - 1) {
                            this.radio1 = this.radio1 - 1
                        }
                        this.reNew()
                    }
                })


            }
        },
        distrbute() {
            this.allForm = []
        
            for (let i = 0; i < this.stageSurveyConfinedSpaceList.length; i++) {
                let kownleageAndPhotoFullScenceImage = [
                    {
                        name: '管道口径', id: 1, componentType: true, content: null, placeholder: '请输入', dictName: 'pipeDiameter', isNumTypeInput: false
                    },
                    {
                        name: '空间类型', id: 2, componentType: false, content: null,placeholder:'下沉式/密封式/敞开式', dictName: 'spaceType', data: [
                            { name: '下沉式', id: 1 },
                            { name: '密封式', id: 2 },
                            { name: '敞开式', id: 3 },
                        ]
                    },
                    {
                        name: '通风效果', id: 3, componentType: false, content: null,placeholder:'正常/无通风/新风系统', dictName: 'ventilationEffect', data: [
                            { name: '正常', id: 1 },
                            { name: '无通风', id: 2 },
                            { name: '新风系统', id: 3 },
                        ]
                    },
                    {
                        name: '密闭面积', id: 4, componentType: true, content: null, dictName: 'closedArea', placeholder: '请输入(数字)', isNumTypeInput: true
                    },
                    {
                        name: '甲烷浓度', id: 5, componentType: true, content: null, dictName: 'cscMethaneConcentration', placeholder: '请输入', isNumTypeInput: false
                    },
                    {
                        name: '氧气浓度', id: 6, componentType: true, content: null, dictName: 'cscCarbonMonoxideConcentration', placeholder: '请输入', isNumTypeInput: false
                    },
                    {
                        name: '一氧化碳浓度', id: 7, componentType: true, content: null, dictName: 'cscCarbonMonoxideConcentration', placeholder: '请输入', isNumTypeInput: false
                    },
                ]
                for (let n = 0; n < kownleageAndPhotoFullScenceImage.length; n++) {
                    if (kownleageAndPhotoFullScenceImage[n].componentType == true) {
                        kownleageAndPhotoFullScenceImage[n].content = this.stageSurveyConfinedSpaceList[i][kownleageAndPhotoFullScenceImage[n].dictName]
                    } else {
                        let value = this.stageSurveyConfinedSpaceList[i][kownleageAndPhotoFullScenceImage[n].dictName]
                        if (value != null && value != '') {
                 
                             kownleageAndPhotoFullScenceImage[n].content = parseInt(this.stageSurveyConfinedSpaceList[i][kownleageAndPhotoFullScenceImage[n].dictName])
                        }
                    }
                    ///描述
                }
                let fullScenceImage = [
                    { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '有限空间场景/有限空间/现场照片',imageHint: '现场照片', imageData: {}, description: '阀门损坏描述' },
                    { id: 1, title: "阀门损坏", imageAddress: [], dictName: 'valveDamage', content: null, upAddress: '有限空间场景/有限空间/阀门损坏', imageHint: '隐患照片',imageData: {}, description: '阀门损坏描述' },
                    { id: 2, title: "管道占压", imageAddress: [], dictName: 'pipelinePressure', content: null, upAddress: '有限空间场景/有限空间/管道占压', imageHint: '隐患照片',imageData: {}, description: '管道占压描述' },
                    { id: 3, title: "管道法兰生锈", imageAddress: [], dictName: 'rustOnPipelineFlanges', content: null, upAddress: '有限空间场景/有限空间/管道法兰生锈',imageHint: '隐患照片', imageData: {}, description: '管道法兰生锈描述' },
                ]

                let energyDeviceSituation = [
                    {
                        name: '厨房燃具', id: 1, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'kitchenGasAppliances', isNumTypeInput: true
                    },
                    {
                        name: '生活锅炉', id: 2, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'livingBoiler', isNumTypeInput: true
                    },
                    {
                        name: '生产锅炉', id: 3, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'productionBoiler', isNumTypeInput: true
                    },
                    {
                        name: '生产燃具', id: 4, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'productionOfGasAppliances', isNumTypeInput: true
                    },
                    {
                        name: '发电设备', id: 5, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'powerPlant', isNumTypeInput: true
                    },
                ]
                for (let n = 0; n < energyDeviceSituation.length; n++) {
                    energyDeviceSituation[n].content = this.stageSurveyConfinedSpaceList[i][energyDeviceSituation[n].dictName]
                }
                let distributeSituation = [
                    {
                        name: '泄漏探测数', id: 1, componentType: true, content: null, placeholder: '请输入(数量)', dictName: 'leakDetections', isNumTypeInput: true
                    }, {
                        name: '报警器', id: 2, componentType: false, content: null, placeholder:'正常/无通风/新风系统',dictName: 'alarm', data: [
                            { name: '正常', id: 1 },
                            { name: '无通风', id: 2 },
                            { name: '新风系统', id: 3 },
                        ]
                    }, {
                        name: '风机配置', id: 3, componentType: false, content: null,placeholder:'未配置/已配置', dictName: 'fanConfiguration', data: [
                            { name: '未配置', id: 1 },
                            { name: '已配置', id: 2 },
                        ]
                    }, {
                        name: '报警联动', id: 4, componentType: false, content: null,placeholder:'可联动/不可联动', dictName: 'alarmLinkage', data: [
                            { name: '可联动', id: 1 },
                            { name: '不可联动', id: 2 },
                        ]
                    }, {
                        name: '配电箱', id: 5, componentType: false, content: null,placeholder:'有漏保/无漏保', dictName: 'distributionBox', data: [
                            { name: '有漏保', id: 1 },
                            { name: '无漏保', id: 2 },
                        ]
                    },
                    { name: '配电箱泄漏值', id: 6, componentType: true, content: null, placeholder: '请输入', dictName: 'leakageValue', isNumTypeInput: false },
                    {
                        name: '排水系统', id: 7, componentType: false, content: null,placeholder:'通畅/不通畅', dictName: 'drainageSystem', data: [
                            { name: '通畅', id: 1 },
                            { name: '不通畅', id: 2 },
                        ]
                    },
                    {
                        name: '排水系统是否滞留硫化氢', id: 8, componentType: false, content: null,placeholder:'是/否', dictName: 'hydrogenSulfideValue', data: [
                            { name: '是', id: 1 },
                            { name: '否', id: 2 },
                        ]
                    },
                  
                ]
                for (let n = 0; n < distributeSituation.length; n++) {
                    if (distributeSituation[n].componentType == true) {
                        distributeSituation[n].content = this.stageSurveyConfinedSpaceList[i][distributeSituation[n].dictName]
                    } else {
                        let value = this.stageSurveyConfinedSpaceList[i][distributeSituation[n].dictName]
                        if (value != null && value != '') {
                            distributeSituation[n].content = parseInt(this.stageSurveyConfinedSpaceList[i][distributeSituation[n].dictName])
                        }
                    }
                }

                let situationImage = [
                    { id: 1, title: "有限空间全景图", imageAddress: [], dictName: 'panorama', content: '', upAddress: '有限空间场景/配置情况/有限空间全景图', imageData: {} },
                    { id: 2, title: "管道设备连接图", imageAddress: [], dictName: 'pipelineEquipmentConnectionDiagram', content: '', upAddress: '有限空间场景/配置情况/管道设备连接图', imageData: {} },
                ]

                let notes=
                    {dictName:'notes',placeholder:'请输入',isNumTypeInput:false,content:null}
                    notes.content=this.stageSurveyConfinedSpaceList[i].notes
                var dict = { data: {}, label: this.allForm.length }
                dict.data['kownleageAndPhotoFullScenceImage'] = kownleageAndPhotoFullScenceImage
                dict.data['fullScenceImage'] = fullScenceImage
                dict.data['energyDeviceSituation'] = energyDeviceSituation
                dict.data['distributeSituation'] = distributeSituation
                dict.data['situationImage'] = situationImage
                dict.data['notes'] = notes
                this.allForm.push(dict)



            }
            this.getImage('勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)', 1)
            this.getImage('勘察范例/有限空间场景/配置情况', 2)
        },
        ///添加新的表单
        add() {



            let stageSurvey = { projectId: this.projectInfo.projectId }


            addLimitSpace(stageSurvey).then(response => {
                if (response.code == 200) {
                    this.reNew()
                }
            })


        },
        scrollHorizontally(event) {
            event.preventDefault();
            const scrollAmount = event.deltaY;
            this.$refs.scrollableDiv.scrollLeft += scrollAmount;
        },
        open() {
            this.$alert('提交有限空间场景成功', '提交成功', {
                confirmButtonText: '确定',
          
            });
        },

        restrictNumericInput(item) {

            const value = item.content;
            // 使用正则表达式验证输入是否为数字
            if (!/^\d*$/.test(value)) {
                // 如果输入不是数字，则移除非数字字符
                if (item.isNumTypeInput == true) {
                    item.content = value.replace(/[^\d]/g, '');
                }
            }
        },
        getImage(path, action) {
            if (action == 1) {
               let fullScenceImage= [
                { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/现场照片', imageData: {}, description: '阀门损坏描述' },
                { id: 1, title: "阀门损坏", imageAddress: [], dictName: 'valveDamage', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/阀门损坏', imageData: {}, description: '阀门损坏描述' },
                { id: 2, title: "管道占压", imageAddress: [], dictName: 'pipelinePressure', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/管道占压', imageData: {}, description: '管道占压描述' },
                { id: 3, title: "管道法兰生锈", imageAddress: [], dictName: 'rustOnPipelineFlanges', content: null, upAddress: '勘察范例/有限空间场景/有限空间(厨房、生产车间、锅炉)/管道法兰生锈', imageData: {}, description: '管道法兰生锈描述' },
            ]
                this.fullScenceImage=fullScenceImage



                getTemplateFileListApi(path).then(response => {
                  
                    if (response.code == 200) {
                        if (response.data.length != 0) {

                            Array.from(response.data).forEach(item => {
                            

                                for (var i = 0; i < this.fullScenceImage.length; i++) {
                              
                                    if (this.fullScenceImage[i].upAddress == item.fileTreePath) {

                                        Array.from(item.fileList).forEach(items => {

                                            this.fullScenceImage[i].imageAddress.push(this.$myGlobalVariable + items)

                                        })
                                    }
                                }

                            }

                            );

                        }

                    }
                })
            } else if (action == 2) {

               let situationImage= [
                { id: 1, title: "有限空间全景图", imageAddress: [], dictName: 'panorama', content: '', upAddress: '勘察范例/有限空间场景/配置情况/有限空间全景图', imageData: {} },
                { id: 2, title: "管道设备连接图", imageAddress: [], dictName: 'pipelineEquipmentConnectionDiagram', content: '', upAddress: '勘察范例/有限空间场景/配置情况/管道设备连接图', imageData: {} },
            ]
            this.situationImage=situationImage
                getTemplateFileListApi(path).then(response => {
                
                    if (response.code == 200) {
                        if (response.data.length != 0) {

                            Array.from(response.data).forEach(item => {
                         

                                for (var i = 0; i < this.situationImage.length; i++) {
                                 
                                    if (this.situationImage[i].upAddress == item.fileTreePath) {

                                        Array.from(item.fileList).forEach(items => {

                                            this.situationImage[i].imageAddress.push(this.$myGlobalVariable + items)

                                        })
                                    }
                                }

                            }

                            );

                        }
                    
                    }
                })
            }
        },
        submit() {
            this.loading=true
            //修改已有的
            let all = { stageSurveyConfinedSpaceList: [] }
            for (let i = 0; i < this.stageSurveyConfinedSpaceList.length; i++) {
                var stageSurvey = { projectId: this.projectInfo.projectId, id: this.stageSurveyConfinedSpaceList[i].id }

                //有限空间
                for (let n = 0; n < this.allForm[i].data['kownleageAndPhotoFullScenceImage'].length; n++) {

                    if (this.allForm[i].data['kownleageAndPhotoFullScenceImage'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['kownleageAndPhotoFullScenceImage'][n].dictName] = this.allForm[i].data['kownleageAndPhotoFullScenceImage'][n].content
                    }
                }
                // //燃气设施情况
                for (let n = 0; n < this.allForm[i].data['energyDeviceSituation'].length; n++) {

                    if (this.allForm[i].data['energyDeviceSituation'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['energyDeviceSituation'][n].dictName] = this.allForm[i].data['energyDeviceSituation'][n].content
                    }
                }

                // //配置情况
                for (let n = 0; n < this.allForm[i].data['distributeSituation'].length; n++) {

                    if (this.allForm[i].data['distributeSituation'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['distributeSituation'][n].dictName] = this.allForm[i].data['distributeSituation'][n].content
                    }
                }
                if (this.allForm[i].data['notes'].dictName!=''){
                    stageSurvey[this.allForm[i].data['notes'].dictName] = this.allForm[i].data['notes'].content
                 }

                all.stageSurveyConfinedSpaceList.push(stageSurvey)
            }

     
            updateSurveyApi(all).then(response => {
this.loading=false
                if (response.code == 200) {
                    this.open()
                }
            })











        },

    }
}
</script>
<style></style>
